package com.example.demo;


import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@Table(name = "user_info")
public class User implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @NotNull(message="年龄不能为空")
    private  Integer age;

    @NotEmpty(message="用户名不能为空")
    private String userName;

    @JSONField(format="yyyy-MM-dd HH:mm:mm")
    private Date birthday;

    @Pattern(regexp = "\\d{17}[\\d|x]|\\d{15}",message = "身份证有误!")
    private String idNumber;

    private Date createTime;

    private Date updateTime;

    public User() {
    }

    public User(String userName, Integer age) {
        this.age = age;
        this.userName = userName;
    }



}
